load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "server",
    srcs = [
        "api_server.go",
        "connector.go",
        "db.go",
        "dex_api.go",
        "dex_token_handler.go",
        "dex_web.go",
        "env.go",
        "provisioner.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/server/identity/server",
    visibility = ["//visibility:public"],
    deps = [
        "//src/identity",
        "//src/internal/dbutil",
        "//src/internal/determined",
        "//src/internal/errors",
        "//src/internal/log",
        "//src/internal/pachconfig",
        "//src/internal/pachsql",
        "//src/internal/pctx",
        "//src/internal/protoutil",
        "//src/internal/serviceenv",
        "//src/server/identityutil",
        "@com_github_determined_ai_determined_proto//pkg/apiv1",
        "@com_github_determined_ai_determined_proto//pkg/userv1",
        "@com_github_dexidp_dex//connector",
        "@com_github_dexidp_dex//pkg/log",
        "@com_github_dexidp_dex//server",
        "@com_github_dexidp_dex//storage",
        "@com_github_dexidp_dex_api_v2//:api",
        "@com_github_prometheus_client_golang//prometheus",
        "@com_github_prometheus_client_golang//prometheus/promauto",
        "@com_github_prometheus_client_golang//prometheus/promhttp",
        "@io_k8s_sigs_yaml//:yaml",
        "@org_golang_google_protobuf//encoding/protojson",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//types/known/structpb",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "server_test",
    size = "small",
    srcs = [
        "api_server_test.go",
        "dex_api_test.go",
        "dex_web_test.go",
    ],
    embed = [":server"],
    pure = "on",
    deps = [
        "//src/auth",
        "//src/identity",
        "//src/internal/backoff",
        "//src/internal/clusterstate",
        "//src/internal/dockertestenv",
        "//src/internal/log",
        "//src/internal/migrations",
        "//src/internal/pachconfig",
        "//src/internal/pctx",
        "//src/internal/protoutil",
        "//src/internal/require",
        "//src/internal/serviceenv",
        "//src/internal/testetcd",
        "//src/internal/testpachd/realenv",
        "//src/internal/testutil",
        "//src/internal/uuid",
        "//src/server/identityutil",
        "@com_github_dexidp_dex//storage",
        "@com_github_dexidp_dex//storage/memory",
        "@org_golang_google_protobuf//types/known/structpb",
    ],
)
